package com.civil.response;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	
	public static String dateAddYear(String str,int num) throws Exception {
		 
		  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		  Date dt = sdf.parse(str);
		  Calendar rightNow = Calendar.getInstance();
		  rightNow.setTime(dt);
		  rightNow.add(Calendar.YEAR, num);// 日期加1年
		  Date dt1 = rightNow.getTime();
		  String reStr = sdf.format(dt1);
		  return reStr;
	}

	
	
	public static void main(String[] args) {
		try {
			System.out.println(dateAddYear("2020-11-25",55));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
